@extends('admin.layout')

@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            {{--<h1>--}}
                {{--批量订单列表--}}
            {{--</h1>--}}
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                {{--<li><a href="#">批量订单查看</a></li>--}}
                <li class="active"> 批量订单查看</li>
            </ol>
            @if(Session::get('roleid') != 4)
                <div class="input-group margin">
                    <div style="float: left">
                        <form action="{{ url('admin/select') }}" method="post" >
                            {{ csrf_field() }}
                            <div style="float: left;line-height: inherit">
                                <input style="width: 120px" type="text" class="form-control" value="请输入手机号" disabled>
                            </div>
                            <div style="float: left" id="form">
                                <input style="width: 200px"  name="param" type="text" class="form-control">
                            </div>
                            <div style="float: left">
                                <input  type="submit" class="btn btn-info btn-flat" value="Go!">
                            </div>
                        </form>
                    </div>
                </div>
            @endif
        </section>
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12" style="width: 100%;">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title"></h3>
                        </div>
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @else
                                <div style="width: 100%;">
                                    <span style="color: green;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ Session::get('msg') }}</span>
                                </div>
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
//                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                        <div class="input-group margin">
                            <table class="table table-striped table-hover text-center">
                                <tr>
                                    <th>编号</th>
                                    <th>创建时间</th>
                                    <th>批次号</th>
                                    <th>兑换时间</th>
                                    <th>客户经理</th>
                                    <th style="width: 130px; text-align:center">操作</th>
                                </tr>
                                    @foreach($v as $value)
                                        <tr>
                                            <td>{{ $value['id'] }}</td>
                                            <td>{{ $value['create_time'] }}</td>
                                            <td>{{ $value['batch'] }}</td>
                                            <td>{{ $value['time'] }}</td>
                                            <td>{{ App\Manage::find($value['manage_id'])['username'] }}</td>
                                            <td>
                                                <a class="btn btn-default btn-xs"  href="{{ url('admin/orders/toAudit/'.$value['batch'] )}}" >查看详细<a>
                                                @if(Session::get('roleid')==1)
                                                    <a class="btn btn-warning btn-xs"  href="{{ url('admin/orders/del/'.$value['batch'] )}}" >删除<a>
                                                @endif
                                            </td>
                                        </tr>
                                    @endforeach
                            </table>
                        </div>
                    </div>
                 </div>
            </div>
        </section>
    </div>
@stop